package com.itheima.health.utils.aliyunDX;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

public class SendSms {
    public static final String VALIDATE_CODE = "SMS_55665182";//发送短信验证码
    public static final String ORDER_NOTICE = "SMS_55665182";//体检预约成功通知

    public static void registerSendCode(String sendyourTelephoneNumber, String codeNumber) {

        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI4GEa1Zst4NbvGQ5MBNH2", "TePhhprd53L3Rf16Wrp3fv8Vp17bs2");
        IAcsClient client = new DefaultAcsClient(profile);

        CommonRequest request = new CommonRequest();
        request.setSysMethod(MethodType.POST);
        request.setSysDomain("dysmsapi.aliyuncs.com");
        request.setSysVersion("2017-05-25");
        request.setSysAction("SendSms");
        request.putQueryParameter("RegionId", "cn-hangzhou");
        request.putQueryParameter("PhoneNumbers", sendyourTelephoneNumber);
        request.putQueryParameter("SignName", "传智健康Z");
        request.putQueryParameter("TemplateCode", "SMS_204755704");
        request.putQueryParameter("TemplateParam", "{\"code\":\"" + codeNumber + "\"}");
        try {
            CommonResponse response = client.getCommonResponse(request);
            System.out.println(response.getData());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
